<include file="Template:pageheader"/>

<style>
	.username{border:1px solid #adadad; height:30px; line-height:30px;text-indent:10px;}
	.content{height:100px;border:1px solid #adadad; padding:10px;border-top:none;}
	.submit{text-align:center;}
</style>
<div>	
	<volist name="comment" id="vo">
		<div class="w90" style="margin-top:50px;">
			<h1 class="dp username h_30">{$lang.user_name}:&nbsp;{$vo.user_id}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$lang.time}:&nbsp;2013-07-23</h1>
			<span class="dp content">
				{$vo.content}
			</span>
			<span class="dp submit">
				<input id="comment_id" type="hidden" name="id" value="{$vo.comment_id}"/>
				<input id="is_show" type="hidden" name="is_show" value="{$vo.is_valid}"/>
				<input id ="textshow" type="button" value="禁止显示" onclick="javascript:comment.update(this);";/>
			</span>
		</div>
	</volist>
</div>
<script>
	
	//改变评论的显示状态
	var opt = {
		url:'__APP__/Comment/update',
		dataType:'json',
		type:'post'
	}
	var comment    = new Object;
	
	comment.update = function(obj){
		var idObj = document.getElementById("comment_id");
		var isShowObj = document.getElementById("is_show");
		var idValue = idObj.value;
		var isShowValue = isShowObj.value;
				
		$.extend(opt,{
			data:{id:idValue,is_valid:isShowValue},
			success:function(msg){
				if(msg.status == 1){
					obj.value = ( msg.data == 1 ) ? "禁止显示" : "允许显示";
					isShowObj.value = msg.data;
				}
			}		
		});
		$.ajax(opt);
	}	
</script>

<include file="Template:pagefooter"/>